packaging: Update infrastructure
authorColin Walters <walters@verbum.org>
Sat, 18 Jan 2014 09:44:54 +0000 (04:44 -0500)
committerColin Walters <walters@verbum.org>
Sat, 18 Jan 2014 09:49:17 +0000 (04:49 -0500)
The Makefile.dist-packaging lives canonically in rpm-ostree/ for now,
it's my latest hack to automate git -> (s)rpm.

Update the spec.in from current Fedora.

Makefile.am
Makefile.dist-packaging [new file with mode: 0644]
packages/ostree.spec.in [deleted file]
packages/rpmbuild-cwd [deleted file]
packages/substitute-gitversion.sh [deleted file]
packaging/91-ostree.preset [new file with mode: 0644]
packaging/ostree.spec.in [new file with mode: 0644]
packaging/rpmbuild-cwd [new file with mode: 0755]

index 451237f48344a2fe7e5ddbe4f0ee65fa85da7df3..b20738a0771631c874259671f3ee5879570f7a46 100644 (file)
@@ -113,28 +113,6 @@ release-tarball-embedded:
        mv ostree-embeddeps-$${GITVERSION}.tar{.tmp,}; \
        gzip -f ostree-embeddeps-$${GITVERSION}.tar 
 
-srpm:
-       GITVERSION=$(git_version_rpm); export GITVERSION; \
-       $(srcdir)/packages/substitute-gitversion.sh $(srcdir)/packages/ostree.spec.in > ostree.spec
-       $(srcdir)/packages/rpmbuild-cwd -bs ostree.spec
-
-dist-snapshot:
-       set -x; \
-       GITVERSION=$(git_version_rpm); export GITVERSION; \
-       TARFILE_TMP=ostree-$${GITVERSION}.tar.tmp; \
-       REV=$$(git rev-parse HEAD); \
-       echo "Archiving ostree at $${REV}"; \
-       (cd $(srcdir); git archive --format=tar --prefix=ostree-$${GITVERSION}/ $${REV}) > $${TARFILE_TMP}; \
-       (cd $$(git rev-parse --show-toplevel); git submodule status) | while read line; do \
-         rev=$$(echo $$line | cut -f 1 -d ' '); path=$$(echo $$line | cut -f 2 -d ' '); \
-         echo "Archiving $${path} at $${rev}"; \
-         (cd $(srcdir)/$$path; git archive --format=tar --prefix=ostree-$${GITVERSION}/$$path/ $${rev}) > submodule.tar; \
-         tar -A -f $${TARFILE_TMP} submodule.tar; \
-         rm submodule.tar; \
-       done; \
-       mv ostree-$${GITVERSION}.tar{.tmp,}; \
-       gzip -f ostree-$${GITVERSION}.tar 
-
 check-local:
        @echo "  *** NOTE ***"
        @echo "  *** NOTE ***"
diff --git a/Makefile.dist-packaging b/Makefile.dist-packaging
new file mode 100644 (file)
index 0000000..75a52f6
--- /dev/null
@@ -0,0 +1,39 @@
+# -*- mode: Makefile -*-
+
+GITREV = $$(git describe --always --tags)
+GITREV_FOR_PKG = $(shell echo "$(GITREV)" | sed -e 's,-,\.,g' -e 's,^v,,')
+
+srcdir=$(shell pwd)
+PACKAGE=$(shell basename $(srcdir))
+
+PKG_VER = $(PACKAGE)-$(GITREV_FOR_PKG)
+
+dist-snapshot:
+       set -x; \
+       echo "PACKAGE=$(PACKAGE)"; \
+       TARFILE_TMP=$(PKG_VER).tar.tmp; \
+       echo "Archiving $(PACKAGE) at $(GITREV)"; \
+       (cd $(srcdir); git archive --format=tar --prefix=$(PKG_VER)/ $(GITREV)) > $${TARFILE_TMP}; \
+       (cd $$(git rev-parse --show-toplevel); git submodule status) | while read line; do \
+         rev=$$(echo $$line | cut -f 1 -d ' '); path=$$(echo $$line | cut -f 2 -d ' '); \
+         echo "Archiving $${path} at $${rev}"; \
+         (cd $(srcdir)/$$path; git archive --format=tar --prefix=$(PKG_VER)/$$path/ $${rev}) > submodule.tar; \
+         tar -A -f $${TARFILE_TMP} submodule.tar; \
+         rm submodule.tar; \
+       done; \
+       mv $(PKG_VER).tar{.tmp,}; \
+       rm -f $(PKG_VER).tar.xz; \
+       xz $(PKG_VER).tar 
+
+srpm: dist-snapshot
+       (cd $(srcdir)/packaging; \
+        cp ../$(PKG_VER).tar.xz . ; \
+        sed -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(PACKAGE).spec.in > $(PACKAGE).spec; \
+        ./rpmbuild-cwd -bs $(PACKAGE).spec)
+
+rpm: srpm
+       $(srcdir)/packaging/rpmbuild-cwd --rebuild packaging/$(PKG_VER)*.src.rpm
+
+buildinstall: rpm
+       sudo yum localinstall $(PKG_VER)*.src.rpm
+
diff --git a/packages/ostree.spec.in b/packages/ostree.spec.in
deleted file mode 100644 (file)
index 41354be..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-# Define this if we want to build with embedded dependencies
-# for e.g. RHEL6
-%define enable_embedded_dependencies 0
-
-%if 0%{?enable_embedded_dependencies}
-%define build_name ostree-embeddeps
-%else
-%define build_name ostree
-%endif
-
-%if 0%{?rhel}
-# HACK to fix building on RHEL6; find_debuginfo is crashing, not sure
-# why
-%define debug_package %{nil}
-%endif
-
-Summary: Linux-based operating system develop/build/deploy tool
-Name: ostree
-Version: 2012.8
-Release: 1%{?dist}
-#VCS: git:git://git.gnome.org/ostree
-Source0: http://ftp.gnome.org/pub/GNOME/sources/ostree/%{version}/%{build_name}-%{version}.tar.gz
-# The libostree.so (currently private) shared library, and almost all
-# of the utilities are licensed under the LGPLv2+.  Only at present
-# one utility program (ostree-switch-root) is forked from util-linux under
-# the GPL.
-# The BSD is there basically just for some random scripts, nothing
-# important.
-# As always, consult the upstream COPYING file, and individual source
-# files for the canonical license status.
-License: LGPLv2+ and GPLv2+ and BSD
-URL: http://live.gnome.org/OSTree
-# We always run autogen.sh
-BuildRequires: autoconf automake libtool
-# Too bad there isn't a pkg-config file =(
-BuildRequires: libattr-devel
-# For docs
-BuildRequires: gtk-doc
-
-Requires: linux-user-chroot
-
-# Embedded GLib dependencies
-%if 0%{?enable_embedded_dependencies}
-BuildRequires: glibc-devel
-BuildRequires: pkgconfig(libffi)
-BuildRequires: python-devel
-BuildRequires: pkgconfig(zlib)
-BuildRequires: pkgconfig(libselinux)
-
-# Embedded libsoup dependencies
-BuildRequires: gnome-common
-BuildRequires: intltool
-BuildRequires: pkgconfig(libxml-2.0)
-%else
-BuildRequires: pkgconfig(gio-unix-2.0)
-BuildRequires: pkgconfig(libsoup-2.4)
-%endif
-
-%description
-See http://live.gnome.org/OSTree
-
-%prep
-%setup -q -n %{build_name}-%{version}
-
-%build
-env NOCONFIGURE=1 ./autogen.sh
-%if 0%{?enable_embedded_dependencies}
-%define embedded_dependencies_option --enable-embedded-dependencies
-%else
-%define embedded_dependencies_option %{nil}
-%endif
-
-%configure --disable-silent-rules \
-          --enable-documentation \
-          --disable-libarchive \
-          %{embedded_dependencies_option}
-make %{?_smp_mflags}
-
-%install
-make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p -c"
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%doc COPYING README.md
-%{_bindir}/ostree
-%{_bindir}/ostree-pull
-%{_bindir}/ostree-run-triggers
-%{_sbindir}/ostree-switch-root
-%{_libexecdir}/ostreed
-%dir %{_libdir}/ostree
-%{_libdir}/ostree/*.so
-%if 0%{?enable_embedded_dependencies}
-%{_libdir}/ostree/libglib*.so*
-%{_libdir}/ostree/libgmodule*.so*
-%{_libdir}/ostree/libgobject*.so*
-%{_libdir}/ostree/libgthread*.so*
-%{_libdir}/ostree/libgio*.so*
-%{_libdir}/ostree/libsoup*.so*
-%endif
-%dir %{_libexecdir}/ostree
-%dir %{_libexecdir}/ostree/triggers.d
-%{_libexecdir}/ostree/triggers.d/*
-%{_mandir}/man1/*.gz
diff --git a/packages/rpmbuild-cwd b/packages/rpmbuild-cwd
deleted file mode 100755 (executable)
index d0805bb..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-# rpmbuild-cwd:
-# Run "rpmbuild", defining all RPM variables to use the current directory.
-# This matches Fedora's system.
-#
-# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
-# Copyright (C) 2010 Red Hat, Inc.
-# Written by Colin Walters <walters@verbum.org>
-
-pwd=$(pwd)
-exec rpmbuild --define "_sourcedir ${pwd}" --define "_specdir ${pwd}" --define "_builddir ${pwd}" --define "_srcrpmdir ${pwd}" --define "_rpmdir ${pwd}" --define "_buildrootdir ${pwd}/.build" "$@"
diff --git a/packages/substitute-gitversion.sh b/packages/substitute-gitversion.sh
deleted file mode 100755 (executable)
index 119bfb0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-set -e
-
-git_version=$(git describe)
-git_version_rpm=$(echo ${git_version} | sed -e 's,-,\.,g' -e 's,^v,,')
-exec sed -e "s,^Version:.*,Version: ${git_version_rpm}," "$@"
diff --git a/packaging/91-ostree.preset b/packaging/91-ostree.preset
new file mode 100644 (file)
index 0000000..ad0970b
--- /dev/null
@@ -0,0 +1 @@
+enable ostree-remount.service
diff --git a/packaging/ostree.spec.in b/packaging/ostree.spec.in
new file mode 100644 (file)
index 0000000..8c28467
--- /dev/null
@@ -0,0 +1,92 @@
+Summary: Git for operating system binaries
+Name: ostree
+Version: 2013.7
+Release: 2%{?dist}
+#VCS: git:git://git.gnome.org/ostree
+Source0: http://ftp.gnome.org/pub/GNOME/sources/ostree/%{version}/ostree-%{version}.tar.xz
+Source1: 91-ostree.preset
+License: LGPLv2+
+URL: http://live.gnome.org/OSTree
+
+# We always run autogen.sh
+BuildRequires: autoconf automake libtool
+# For docs
+BuildRequires: gtk-doc
+# Core requirements
+BuildRequires: pkgconfig(gio-unix-2.0)
+BuildRequires: pkgconfig(libsoup-2.4)
+BuildRequires: libattr-devel
+# Extras
+BuildRequires: pkgconfig(libarchive)
+BuildRequires: gpgme-devel
+BuildRequires: pkgconfig(systemd)
+BuildRequires: /usr/bin/g-ir-scanner
+BuildRequires: dracut
+
+# Runtime requirements
+Requires: dracut
+Requires: systemd-units
+
+%description
+OSTree is a tool for managing bootable, immutable, versioned
+filesystem trees. While it takes over some of the roles of tradtional
+"package managers" like dpkg and rpm, it is not a package system; nor
+is it a tool for managing full disk images. Instead, it sits between
+those levels, offering a blend of the advantages (and disadvantages)
+of both.
+
+%package devel
+Summary: Development headers for %{name}
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+The %{name}-devel package includes the header files for the %{name} library.
+
+%prep
+%setup -q -n ostree-%{version}
+
+%build
+env NOCONFIGURE=1 ./autogen.sh
+%configure --disable-silent-rules \
+          --enable-gtk-doc \
+          --disable-libarchive \
+          --with-dracut
+make %{?_smp_mflags}
+
+%install
+make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p -c"
+find $RPM_BUILD_ROOT -name '*.la' -delete
+install -D -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/%{_prefix}/lib/systemd/system-preset/91-ostree.preset
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+%systemd_post ostree-remount.service
+
+%preun
+%systemd_preun ostree-remount.service
+
+%files
+%doc COPYING README.md
+%{_bindir}/ostree
+%{_sbindir}/ostree-prepare-root
+%{_sbindir}/ostree-remount
+%{_sysconfdir}/dracut.conf.d/ostree.conf
+%dir %{_prefix}/lib/dracut/modules.d/98ostree
+%{_prefix}/lib/systemd/system/ostree*.service
+%{_prefix}/lib/dracut/modules.d/98ostree/*
+%{_libdir}/*.so.1*
+%{_libdir}/girepository-1.0/OSTree-1.0.typelib
+%{_mandir}/man1/*.gz
+%{_prefix}/lib/systemd/system-preset/91-ostree.preset
+
+%files devel
+%{_libdir}/lib*.so
+%{_includedir}/*
+%{_libdir}/pkgconfig/*
+%{_datadir}/ostree
+%dir %{_datadir}/gtk-doc/html/ostree
+%{_datadir}/gtk-doc/html/ostree
+%{_datadir}/gir-1.0/OSTree-1.0.gir
diff --git a/packaging/rpmbuild-cwd b/packaging/rpmbuild-cwd
new file mode 100755 (executable)
index 0000000..d0805bb
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+# rpmbuild-cwd:
+# Run "rpmbuild", defining all RPM variables to use the current directory.
+# This matches Fedora's system.
+#
+# Licensed under the new-BSD license (http://www.opensource.org/licenses/bsd-license.php)
+# Copyright (C) 2010 Red Hat, Inc.
+# Written by Colin Walters <walters@verbum.org>
+
+pwd=$(pwd)
+exec rpmbuild --define "_sourcedir ${pwd}" --define "_specdir ${pwd}" --define "_builddir ${pwd}" --define "_srcrpmdir ${pwd}" --define "_rpmdir ${pwd}" --define "_buildrootdir ${pwd}/.build" "$@"